<template>
  <common-dialog ref="dialog" title="分配业务员列表" width="500px" :in-dialog="inDialog">
    <list ref="list" in-dialog page @get-data="onGetData" :query-params="queryParams" :data="data" :total="total"
      custom-get-data show-query>
      <template #query>

        <el-form-item label="姓名">
          <el-input v-model="queryParams.userName" clearable />
        </el-form-item>
      </template>
      <template #column>
        <el-table-column prop="allocationUserName" min-width="150" label="业务员名称" sortable>
          <template v-slot="{ row }">
            <span class="c-link" @click="showUserDetail(row.allocationUserId)">{{ row.allocationUserName }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="total" width="150" label="分发数量" sortable />
      </template>
    </list>
    <user-detail-dialog in-dialog ref="userDetailDialog" />
  </common-dialog>
</template>
<script>
import commonDialog from "@/components/common/dialog";
// import list from "./examineStatusExceptionList";
import list from "@/components/common/list";
// import listDialogMixins from "@/mixins/listDialog";
import userDetailDialog from "@/components/sso/user/detailDialog";
import api from "@/api/crm/seaPoolStatistics"

export default {
  components: { commonDialog, list, userDetailDialog },
  // mixins: [listDialogMixins],
  props: {
    inDialog: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      queryParams: {

      },
      data: [],
      total: 0
    }
  },
  methods: {
    async showData(data) {
      await this.$refs.dialog.show();
      this.$refs.list.initData(data);
    },
    async onGetData(params) {
      this.$refs.list.loading(true);
      let res = await api.getAllocationUsers(params);
      this.data = res.data.list;
      this.total = res.data.total;
      this.$refs.list.loading(false);
    },
    showUserDetail(userId) {
      this.$refs.userDetailDialog.openDetail(userId);
    }
  }
};
</script>